package edu.ynu.se.xiecheng.achitectureclass.service.Impl;

import edu.ynu.se.xiecheng.achitectureclass.dao.AirTemperatureDataDao;
import edu.ynu.se.xiecheng.achitectureclass.dao.CO2DataDao;
import edu.ynu.se.xiecheng.achitectureclass.dto.DataDTO;
import edu.ynu.se.xiecheng.achitectureclass.service.AirTemperatureService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AirTemperatureServiceImpl implements AirTemperatureService {

    @Autowired
    private AirTemperatureDataDao airTemperatureDataDao;

    @Override
    public List<DataDTO> findLatestTenAirTemperatureData() {
        Pageable pageable = PageRequest.of(0, 10);  // 第一个参数是页码（从0开始），第二个参数是每页返回的记录数
        return airTemperatureDataDao.findLatestTenAirTemperatureData(pageable);
    }
}
